package com.ruoyi.dto;

import lombok.Data;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * @author chongjin
 * @date 2023/6/12
 */
@Data
public class RecordInfoDTO {

    private String roomId;

    private String contractId;

    private String payRecordId;

    private BigDecimal powerNumber;

    private BigDecimal waterNumber;

    private BigDecimal networkMoney;

    private BigDecimal cleanMoney;
    /**
     * 支付类型:-1未支付1现金2银行卡3微信4支付宝
     */
    private Integer payType;

    public void setPowerNumber(BigDecimal powerNumber) {
        this.powerNumber = resetScale(powerNumber);
    }

    public void setWaterNumber(BigDecimal waterNumber) {
        this.waterNumber = resetScale(waterNumber);
    }

    public void setNetworkMoney(BigDecimal networkMoney) {
        this.networkMoney = resetScale(networkMoney);
    }

    public void setCleanMoney(BigDecimal cleanMoney) {
        this.cleanMoney = resetScale(cleanMoney);
    }

    private BigDecimal resetScale(BigDecimal bigDecimal) {
        return Objects.isNull(bigDecimal) ? null :
                bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
}
